package com.ruima.erp.framework.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class ConfigUtil {
	
private static Properties properties = null;

	public static final String KEY_SINA_ACCESSTOKEN = "sina_access_token";	
	public static final String KEY_SINA_APPKEY = "sina_client_ID";	
	public static final String KEY_SINA_APPSECRET = "sina_client_SERCRET";	
	public static final String KEY_SINA_REDIRECTURI = "sina_redirect_URI";	
	public static final String KEY_SINA_BASEURL = "sina_baseURL";	
	public static final String KEY_SINA_ACCESSTOKENURL = "sina_accessTokenURL";	
	public static final String KEY_SINA_AUTHORIZEURL = "sina_authorizeURL";	
	public static final String KEY_SINA_RMURL = "sina_rmURL";
	
	public static final String KEY_QQ_ACCESSTOKEN = "qq_access_token";	
	public static final String KEY_QQ_APPKEY = "qq_app_key";	
	public static final String KEY_QQ_APPSECRET = "qq_app_secret";	
	public static final String KEY_QQ_REDIRECTURI = "qq_redirect_uri";	
	public static final String KEY_QQ_OPENID = "qq_open_id";	
	public static final String KEY_QQ_EXPIRESIN = "qq_expiresIn";
	public static final String KEY_QQ_REFRESH_TOKEN = "qq_refresh_token";
	
	public static final String EAGLEEYE_RAWCONTENT_PATH = "rawContentPath";
	public static final String EAGLEEYE_LOG_PATH = "EagleEye_log_Path";
	
	public static final String REST_URL = "REST_URL";
	public static final String REST_URL_CONFIG = "REST_URL_CONFIG";
	public static final String REST_URL_DATE_POST = "REST_URL_DATE_POST";
	public static final String REST_URL_ROOTSITECOUNT_POST = "REST_URL_ROOTSITECOUNT_POST";
	public static final String REST_URL_GET_DICT = "REST_URL_GET_DICT";
	
	public static final String KEY_EMAILADDRESS = "EmailAddress";
	
	
	
	
	
	public static void init() {
		if(properties == null){
			properties = new Properties();
			try {
				properties.load(Thread.currentThread().getContextClassLoader()
						.getResourceAsStream("jdbc.properties"));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}		
	}

	public static String getValue(String key) {
		if(properties == null){
			init();
		}
		return properties.getProperty(key);
	}

	public static void updateProperties(String key, String value) {
		if(properties == null){
			init();
		}
		properties.setProperty(key, value);
	}

}
